import axios from '../../plugins/axios.js'

const state = {
	user:{
		err:2,
		msg:'token失败',
		token:'',
		data:{}
		
	}  
}

const actions = {
	user : async({state,commit},{_id,collectionName})=>{
		//判断payload是不是数组
		let {data} = await axios.get(`/user`)
		//success ?->判断payload是不是对象
		commit('user',data)
	},
	// login(){},
	// reg(){}
}

const mutations = {
	user:(state,payload)=>state.user=payload
}

export default {
	namespaced:true,
	state,actions,mutations
}
